package com.zzptc.easyshop.servlet;

import com.sun.xml.internal.ws.resources.HttpserverMessages;
import com.zzptc.easyshop.vo.Users;

import javax.jws.soap.SOAPBinding;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import java.io.IOException;
import java.util.List;

@WebServlet(name = "ModifyServlet")
public class ModifyServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding( "utf-8" );
        response.setCharacterEncoding( "utf-8" );
        response.setContentType( "text/html;charset=UTF-8" );
        String id = request.getParameter( "id" );

        Users users = null;

        HttpSession session = request.getSession();
        List<Users> list = (List) session.getAttribute( "allusers" );
        for (Users s: list){
            if (s.getEu_user_id().equals( id )){
            users=s;
                break;
        }
        }
        session.setAttribute( "userinfo" ,users);
        request.getRequestDispatcher( "manage/user-modify.jsp" ).forward( request,response );
    }
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    doPost( request,response );
    }
}
